function valiArt(title,content,vnum,firstnum,secondnum){
  let errors = "";
  if(!title || title.length > 30){
    errors = errors || {};
    errors.title = "文章标题不得为空，且应在30字以内。";
  }
  if(!content){
    errors = errors || {};
    errors.content = "留言信息不得为空。";
  }
  if(!(Number(vnum) === firstnum + secondnum)){
    errors = errors || {};
    errors.vnum = "验证码输入有误，请重新输入。";
  }
  console.log(errors);
  return errors;
}

function showInfo(errors){
  if(errors){
    // console.log(errors);
    errors = JSON.parse(errors);
    if(errors.title){
      titleerror.innerText = errors.title;
    }
    if(errors.content){
      contenterror.innerText = errors.content;
    }
    if(errors.vnum){
      vnumerror.innerText = errors.vnum;
    }
  }
}

if(typeof window === "undefined"){
  module.exports = valiArt;
}
